package com.lvmama.rhino.pojo;

import java.util.Arrays;
import java.util.List;

import com.github.pagehelper.PageInfo;

/**
 * 说明：
 * 
 * @author yecan
 * @date 2016年7月7日
 */
public class PushReturn {

	@Override
	public String toString() {
		return "PushReturn [pageBar=" + Arrays.toString(pageBar) + ", count="
				+ count + ", pushList=" + pushList + ", pageInfo=" + pageInfo
				+ "]";
	}

	private Integer pushListSize;
	public Integer getPushListSize() {
		return pushListSize;
	}

	public void setPushListSize(Integer pushListSize) {
		this.pushListSize = pushListSize;
	}

	private int[] pageBar;
	public void setPageBar() {
		int beginPage;
		int endPage;
		if (pageInfo.getPages() <= 10) {
			beginPage = 1;
			endPage = pageInfo.getPages();
		} else {
			// 总页码大于10 前五后四
			beginPage = pageInfo.getPageNum() - 5;
			endPage = pageInfo.getPageNum() + 4;
			// 排除 小于 0 大于总页码情况
			if (beginPage <= 0) {
				beginPage = 1;
				endPage = beginPage + 9;
			}

			if (endPage >= pageInfo.getPages()) {
				endPage = pageInfo.getPages();
				beginPage = pageInfo.getPages() - 9;
			}

		}
		// 定好 起始数字 末尾数字 计算
		this.pageBar = new int[endPage - beginPage + 1];
		int index = 0;
		for (int i = beginPage; i <= endPage; i++) {
			this.pageBar[index++] = i;
		}
	}

	public int[] getPageBar() {
		return pageBar;
	}

	private Long count;
	private List<PushData> pushList;
	private PageInfo pageInfo;

	public PageInfo getPageInfo() {
		return pageInfo;
	}

	public void setPageInfo(PageInfo pageInfo) {
		this.pageInfo = pageInfo;
	}

	public Long getCount() {
		return count;
	}

	public void setCount(Long count) {
		this.count = count;
	}

	public List<PushData> getPushList() {
		return pushList;
	}

	public void setPushList(List<PushData> pushList) {
		this.pushList = pushList;
	}
}
